<?php
include_once('../lib/config.php');
require ($war_root.'/lib/verify.php');
require ($war_root.'/lib/has_char.php');
require ($war_root.'/lib/is_approved.php');
require ($war_root.'/lib/is_admin.php');


$_category = "Admin";
$_title = "";
$admin_active = 1;
$log_char = $character["character_name"];
$debug=0;

if (@$_GET ['a'] != "adding" || @$_GET ['s'] == 2) require ($war_root.'/lib/head.php');

$page = @$_GET ['p'];
$action = @$_GET ['a'];
$raid_id = @$_GET ['raid'];
$system_id = @$system ["system_id"];



/*****************************
* Start Log part
*****************************/

$n_actions = 500;
$system_id = $system ["system_id"];

boxTop ( "Show Log" );

echo 'View the last ' . $n_actions . ' actions that have taken place on this tier.' . '<br /><br />' . '<table>' . '<tr>' . '<th>When</th>' . '<th>Who</th>' . '<th>What</th>' . '<th>How</th>' . '</tr>';

$sql = "select * from wm_logs left join wm_characters on wm_logs.log_character = wm_characters.character_id where log_system_id=$system_id order by log_datetime desc limit $n_actions";
$result = $db->query ( $sql );
while ( $alog = $db->fetch_assoc ( $result ) ) {
	echo '<tr>';
	echo '<td>' . date ( "D d M g:i a", strtotime ( $alog ["log_datetime"] ) ) . '</td>' . '<td><a href="character.php?id=' . $alog ["character_id"] . '">' . $alog ["character_name"] . '</a></td><td>';
	if ($alog ["log_admin"]) echo '<b>';
	echo $alog ["log_type"];
	if ($alog ["log_admin"]) echo '</b>';
	echo '</td><td>' . $alog ["log_description"] . '</td></tr>';

}
echo '</table>';

echo '';
boxBot ();




require ($war_root.'/lib/foot.php');

?>